#include "helicopter.h"

// Make a helicopter object
Helicopter::Helicopter(QWidget * _parent)
{
    this->setParent(_parent); // set the parent

    // Initialize this label
    this->setGeometry(15, 30, 120, 50);
    this->setObjectName("helicopter");

    // Set up movie
    animMovie = new QMovie();
    animMovie->setParent(this);

    // Add the movie
    SetHelicopterMovie("images/heliright.mng", false);

    // Create the timer to make it move
    HelTimer *timer = new HelTimer(((HelicopterForm*)(this->parent())));
    timer->object = this;

    // Create a droptimer for this app
    DropTimer *dTimer = new DropTimer(((HelicopterForm*)(this->parent())));
    dTimer->object = this;
}

void Helicopter::SetHelicopterMovie(QString link, bool isTurn)
{
    // Add the movie
    animMovie->stop();
    animMovie->setFileName(link);
    this->setMovie(animMovie);

    if (isTurn == false)
    {
        animMovie->setSpeed(999);
    } else
    {
        animMovie->setSpeed(333);
    }
    animMovie->start();
}
